//Instructions Group
`define GROUP_MOV 3'h2
`define GROUP_OP  3'h3
`define GROUP_JMP 3'h5
//Instruction Type
`define SP_INS 1'b0
`define PP_INS 1'b1

//Instruction 
`define HALT       7'h00
`define NOP        7'h10
`define BUB        7'h10
`define IRMOV16     7'h20
`define RMMOV16     7'h21
`define RMMOV32    7'h22
`define MRMOV16     7'h23
`define MRMOV32    7'h24
`define RRMOV16      7'h25
`define RRMOV32      7'h26

`define ADD        7'h30
`define SUB        7'h31
`define MULT       7'h32

`define RET 7'h40
`define CALL 7'h41
`define PUSH 7'h42
`define POP 7'h43

`define JMP        7'h50
`define JMPLE      7'h51
`define JMPL       7'h52
`define JMPE      7'h53
`define JMPNE       7'h54
`define JMPGE      7'h55
`define JMPG      7'h56

//PP  only Instruction
`define STARTPP 7'h01//STARTPP MAX_PP_Indx,Disp[17:2],this instruction can only be issued when all PP is idle,otherwise just wait.It's the Dispatch's job to ensure this.

//conditions
`define CND_YES 4'h0
`define CND_LE 4'h1
`define CND_L 4'h2 // < 
`define CND_E 4'h3 // == 
`define CND_NE 4'h4 // != 
`define CND_GE 4'h5 // >= 
`define CND_G 4'h6 // >

//status
`define ST_AOK        3'h0
`define ST_HLT        3'h1
`define ST_ADR        3'h2
`define ST_INS        3'h3

//regs
`define R0  4'h0
`define R1  4'h1
`define RSP 4'h1//stack pointer ,also named R1
`define R2  4'h2
`define R3 4'h3
`define R4 4'h4
`define R5 4'h5
`define R6 4'h6
`define R7 4'h7
`define RNULL 4'hF

`define UNPACK_ARRAY(PK_WIDTH,PK_LEN,M_LEN,PK_DEST,PK_SRC,GEN_NAME1,GEN_NAME2)  generate   							 for (unpk_idx=0; unpk_idx<(PK_LEN); unpk_idx=unpk_idx+1) 							 begin :GEN_NAME1										assign PK_DEST[unpk_idx][((PK_WIDTH)-1):0] = PK_SRC[((PK_WIDTH)*unpk_idx+(PK_WIDTH-1)):((PK_WIDTH)*unpk_idx)]; 							 end                 endgenerate					  generate 							 for (unpk_idx=PK_LEN; unpk_idx<(M_LEN); unpk_idx=unpk_idx+1) 							 begin :GEN_NAME2								assign PK_DEST[unpk_idx][((PK_WIDTH)-1):0] = 0; 							 end                 endgenerate  //
`define PACK_ARRAY(PK_WIDTH,PK_LEN,M_LEN,PK_SRC,PK_DEST,GEN_NAME1,GEN_NAME2) generate  for (pk_idx=0; pk_idx<(PK_LEN); pk_idx=pk_idx+1) 							 begin:GEN_NAME1 			assign PK_DEST[((PK_WIDTH)*pk_idx+((PK_WIDTH)-1)):((PK_WIDTH)*pk_idx)] = PK_SRC[pk_idx][((PK_WIDTH)-1):0]; 							 end endgenerate					 generate 	 for (pk_idx=PK_LEN; pk_idx<(M_LEN); pk_idx=pk_idx+1) 							 begin	:GEN_NAME2							 assign PK_DEST[((PK_WIDTH)*pk_idx+((PK_WIDTH)-1)):((PK_WIDTH)*pk_idx)] =0;							 end 					 endgenerate  //
